// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: GHZ Setup Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
public alias  256 		: GROUP_PLAYERS
public alias  65536 	: HITBOX_AUTO
public alias  arrayPos6 : currentPlayer

private alias Object.Value0 : Object.Timer

event ObjectMain
if object[40].state <= 6
	Object.Priority = PRIORITY_ACTIVE
	object.drawOrder = 6

	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)	
		//Top
	//	BoxCollisionTest(C_BOX, object.entityPos, 175, 66, 173, 141, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
		//Bottom
		temp0 = screen.xcenter
		temp0 -= 38
		temp1 = screen.xcenter
		temp1 += 38			
		BoxCollisionTest(C_BOX, object.entityPos, temp0, 139, temp1, 141, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
		BoxCollisionTest(C_TOUCH, object.entityPos, temp0, 66, temp1, 68, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
		if checkResult == 1
			if inputdown.down == 1

			else
				object[currentPlayer].yvel = 0
			end if
		end if			


		//Left
		temp0 = screen.xcenter
		temp0 -= 38
		temp1 = screen.xcenter
		temp1 -= 36	
		BoxCollisionTest(C_TOUCH, object.entityPos, temp0, 66, temp1, 141, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
		if checkResult == 1
			if inputdown.right == 1

			else
				object[currentPlayer].speed = 0
				object[currentPlayer].xvel = 0
			end if
		end if


		
		//Right
		temp0 = screen.xcenter
		temp0 += 35
		temp1 = screen.xcenter
		temp1 += 33	
		BoxCollisionTest(C_TOUCH, object.entityPos, temp0, 66, temp1, 141, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
		if checkResult == 1
			if inputdown.left == 1

			else
				object[currentPlayer].speed = 0
				object[currentPlayer].xvel = 0
			end if
		end if
		
	next
else	//cease
	object.type = TypeName[Blank Object]
end if
end event

event ObjectDraw

end event

event ObjectStartup

end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("IIZ/Objects1.gif")
	SpriteFrame(0, 0, 64, 64, 153, 154)
end event
